package com.atguigu.guli.service.edu.controller.api;


import com.atguigu.guli.service.edu.entity.Teacher;
import com.atguigu.guli.service.edu.service.TeacherService;
import com.atguigu.guli.service.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;



@RestController
@RequestMapping("api/edu/teacher")

public class ApiTeacherController {
    @Autowired
    TeacherService teacherService;

    @GetMapping("/list")
    public R getList(){
        List<Teacher> list = teacherService.list(null);
        return R.ok().data("items",list);
    }

    //根据id查询讲师信息
    @GetMapping("/getTeacher/{id}")
    public R getTeacher(@PathVariable String id){
        Teacher teacher = teacherService.getById(id);
        return R.ok().data("item",teacher);
    }

}

